package book.daoimp;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.SessionFactory;

import book.dao.loginDAO;
import book.dto.manager;

public class loginDAOImpl implements loginDAO {

	private SessionFactory sessionFactory;

	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}

	public boolean login(manager manager) {
		boolean flag=true;
		Query query = sessionFactory.getCurrentSession().createQuery("from manager where mname='"+manager.getMname()+"' and mpw='"+manager.getMpw()+"'");
		List<manager> list =query.list();
		if(list.size()==0){
			flag=false;
		}
		return flag;
	}
}
